package ioc.beanfactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;

import aop.xyz.myapp.domain.account.User;

public class DefaultUserManager implements UserManager {
    private Logger log = LoggerFactory.getLogger(DefaultUserManager.class);

    private Integer maxTries = 2;

    public void delete(User user) {
        Assert.notNull(user, "cannot delete a NULL user.");
        log.debug(user.getFirstName() + " was deleted");
    }

    public User get(Long id) {
        Assert.notNull(id, "id cannot be NULL.");
        log.debug("got user: " + id);
        return null;
    }

    public void save(User user) {
        Assert.notNull(user, "user cannot be NULL.");
        log.debug("saved user: " + user.getFirstName());
    }

    public void setMaxTries(Integer maxTries) {
        this.maxTries = maxTries;
    }

    public Integer getMaxTries() {
        return maxTries;
    }

}
